package rank;

import java.util.TreeSet;

import data.RankPlayer;

public class RankLevel {
	public TreeSet<RankPlayer> index = new TreeSet<RankPlayer>();
	public int countMax = 100;
	
	public RankLevel() {
	}
	
	public int count() {
		return index.size();
	}
	
	
	public void add(RankPlayer node) {
		index.add(node);
		if (index.size() > countMax) {
			index.pollLast();
		}
	}

	public void remove(RankPlayer player) {
		index.remove(player);
	}

	public void update(RankPlayer node, int score) {
		index.remove(node);
		node.pvpScore = score;
		index.add(node);
	}
}
